#pragma once

#include <qwidget.h>
#include "qmfcapp.h"

class CWnd;

class QWinWidget : public QWidget
{
	Q_OBJECT
public:
	QWinWidget( HWND hParentWnd, QObject *parent = 0, Qt::WFlags f = 0 );

	QWinWidget( CWnd *parnetWnd, QObject *parent = 0, Qt::WFlags f = 0 );

	~QWinWidget();

	void show();
	void center();
	void showCentered();

	HWND parentWindow() const;

protected:
	void childEvent( QChildEvent *e );
	bool eventFilter( QObject *o, QEvent *e );

	bool focusNextPrevChild(bool next);
	void focusInEvent(QFocusEvent *e);

	bool winEvent(MSG *msg, long *result);

private:
	void init();

	void saveFocus();
	void resetFocus();

	HWND hParent;
	HWND prevFocus;
	bool reenable_parent;
};
